From: Brian Wolff Date: Thu, 22 May 2014 20:44:39 +0000 (-0300) Subject: Double check its safe before dropping new table during db cloning X-Git-Tag: 1.31.0-rc.0~15255 X-Git-Url: http://git.cyclocoop.org/%22.%24match%5B1%5D.%22?a=commitdiff_plain;h=8e98f9e3e6c557ad75c9e2b00115e784aa335026;p=lhc%2Fweb%2Fwiklou.git Double check its safe before dropping new table during db cloning parserTests.php just killed my user table :( Bug: 65654 Change-Id: Idcf1c6af6a513c9e6dc650237863db8d61519886 --- diff --git a/includes/db/CloneDatabase.php b/includes/db/CloneDatabase.php index 3017ea809b..9eb3e2fa61 100644 --- a/includes/db/CloneDatabase.php +++ b/includes/db/CloneDatabase.php @@ -91,6 +91,11 @@ class CloneDatabase { if ( $this->dropCurrentTables && !in_array( $this->db->getType(), array( 'postgres', 'oracle' ) ) ) { + if ( $oldTableName === $newTableName ) { + // Last ditch check to avoid data loss + throw new MWException( "Not dropping new table, as '$newTableName'" + . " is name of both the old and the new table." ); + } $this->db->dropTable( $tbl, __METHOD__ ); wfDebug( __METHOD__ . " dropping {$newTableName}\n" ); //Dropping the oldTable because the prefix was changed